"""
带参数的函数装饰器，不修改原有加法函数，但可以打印加法表达式
"""
import logging

logging.basicConfig(format="%(pathname)s:%(lineno)d %(levelname)s %(message)s", level=logging.INFO)

def log(prefix):
    logging.info(prefix)
    def decorator(func):
        def wrapper(*argc, **kwargs):
            my_sum = func(*argc, **kwargs)
            logging.info(f"{argc[0]} + {argc[1]} = {my_sum}")
            return my_sum
        return wrapper
    return decorator

@log(prefix="heir")
def my_add(num1, num2):
    my_sum = num1 + num2
    return my_sum

my_add(3,4)
